﻿using UnityEngine;
using System.Collections;

namespace Battle.View
{
    /*
    public class BattleAttackState : Fsm.FsmStateBase<CameraState>
    {
        public enum CameraAttackerSubState {
            None,
            Near,
            Far,
        }
        public enum CameraDefenderSubState {
            None,
            Play
        }
        CameraController controller;
        public BattleAttackState( CameraState stateType, CameraController controller )
            :base(stateType,controller)
        {
            this.controller = controller;
        }
        CameraAttackerSubState curAttackerSubState = CameraAttackerSubState.None;
        CameraDefenderSubState curDefenderSubState = CameraDefenderSubState.None;
        public override void Enter()
        {
            var camp = BattleManager.GetInstance().battleViewCtrl.curRunningCamp;
            var isMelee = true;
            if(BattleManager.GetInstance().battleViewCtrl.curRunningCamp == BattleCamp.Attacker)
            {
                curDefenderSubState = CameraDefenderSubState.None;
                if (curAttackerSubState == CameraAttackerSubState.None)
                {
                    if (isMelee)
                    {
                        curAttackerSubState = CameraAttackerSubState.Near;
                        controller.animationKit.Play(CameraAnimationType.READY_TO_NEAR_BATTLING);
                        controller.animationKit.PlayQueue(CameraAnimationType.NEAR_TO_BATTLING);
                    }
                    else {
                        curAttackerSubState = CameraAttackerSubState.Far;
                        controller.animationKit.Play(CameraAnimationType.READY_TO_FAR_BATTLING);
                        controller.animationKit.PlayQueue(CameraAnimationType.FAR_TO_BATTLING);
                    }
                }
                else if (curAttackerSubState == CameraAttackerSubState.Far)
                {
                    if (isMelee)
                    {
                        curAttackerSubState = CameraAttackerSubState.Near;
                        controller.animationKit.Play(CameraAnimationType.READY_TO_NEAR_BATTLING);
                        controller.animationKit.PlayQueue(CameraAnimationType.NEAR_TO_BATTLING);
                    }
                }
                else if (curAttackerSubState == CameraAttackerSubState.Near) {
                    if (!isMelee) {
                        curAttackerSubState = CameraAttackerSubState.Far;
                        controller.animationKit.Play(CameraAnimationType.READY_TO_FAR_BATTLING);
                        controller.animationKit.PlayQueue(CameraAnimationType.FAR_TO_BATTLING);
                    }
                }
            }
            else
            {
                curAttackerSubState = CameraAttackerSubState.None;
                if (curDefenderSubState == CameraDefenderSubState.None)
                {
                    curDefenderSubState = CameraDefenderSubState.Play;
                    controller.animationKit.Play(CameraAnimationType.OUR_TEAM_BEHIT);
                    controller.animationKit.PlayQueue(CameraAnimationType.OUR_TEAM_BEHITING);
                }
                else {

                }
            }
        }
        public override void Leave()
        {

        }

        public void Reset() {
            curAttackerSubState = CameraAttackerSubState.None;
            curDefenderSubState = CameraDefenderSubState.None;
        }

        void PlayerRunning()
        {
            if( controller.PreviewStateType == CameraState.EnterBattleScene || 
                controller.PreviewStateType == CameraState.Null || 
                controller.PreviewStateType == CameraState.BattleReady )
            {
                //如果是近战
                controller.animationKit.Play( CameraAnimationType.READY_TO_NEAR_BATTLING );
                //如果是远程
                //controller.animationKit.Play( CameraAnimationType.READY_TO_FAR_BATTLING );
            }

            else if( controller.PreviewStateType == CameraState.BattleCenterWait )
            {
                //如果是近战
                controller.animationKit.Play( CameraAnimationType.CENTER_TO_NEAR );
            }
            else if( controller.PreviewStateType == CameraState.BattleAttack )
            {
                //如果是近战
                controller.animationKit.Play( CameraAnimationType.NEAR_TO_BATTLING );
            }
        }

        void RivalRunning()
        {
            if( controller.PreviewStateType == CameraState.EnterBattleScene || 
                controller.PreviewStateType == CameraState.Null || 
                controller.PreviewStateType == CameraState.BattleReady )
            {
                controller.animationKit.Play( CameraAnimationType.OUR_TEAM_BEHIT );
            }
            else
            {
                controller.animationKit.Play( CameraAnimationType.OUR_TEAM_BEHITING );
            }
        }
    }
    */
}